﻿package kliment.controls {
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import kliment.display.MovieClipButton;
	import kliment.events.MovieClipButtonEvent;
	
	/**
	 * ...
	 * @author Kliment
	 * @version	1.0.1
	 * 
	 * class name: kliment.controls.MovieButton
	 */
	public class MovieButton extends MovieClipButton {
		
		public function MovieButton(target_mc:MovieClip = null) {
			super(target_mc);
			
			addEventListener(MovieClipButtonEvent.ROLL_OVER, _simpleMouseEventsHandler);
			addEventListener(MovieClipButtonEvent.ROLL_OUT, _simpleMouseEventsHandler);
			addEventListener(MovieClipButtonEvent.RELEASE_OUTSIDE, _simpleMouseEventsHandler);
		}
		
		private function _simpleMouseEventsHandler(event:MovieClipButtonEvent):void {
			switch(event.type) {
				case MovieClipButtonEvent.ROLL_OVER:
					setFocus();
				break;
				
				case MovieClipButtonEvent.ROLL_OUT:
				case MovieClipButtonEvent.RELEASE_OUTSIDE:
					resetFocus();
				break;
			}
		}
		
		public function setFocus():void {
			
		}
		
		public function resetFocus():void {
			
		}
		
		override public function remove():DisplayObject {
			removeEventListener(MovieClipButtonEvent.ROLL_OVER, _simpleMouseEventsHandler);
			removeEventListener(MovieClipButtonEvent.ROLL_OUT, _simpleMouseEventsHandler);
			removeEventListener(MovieClipButtonEvent.RELEASE_OUTSIDE, _simpleMouseEventsHandler);
			return super.remove();
		}
	}

}